<template>
  <div class="report">
    <!-- 面包屑 -->
    <bread :item="['数据统计','数据报表']"></bread>
    <!-- 卡片视图 -->
    <el-card>
        <div class="main" style="width:800px;height:500px"></div>
    </el-card>
  </div>
</template>

<script>
import { bread , default as fn} from "tools"
import _ from "lodash"
import echarts from "echarts"
export default {
  components:{bread}
 ,data(){return{
   options: {
        title: {
          text: '用户来源'
        },
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            type: 'cross',
            label: {
              backgroundColor: '#E9EEF3'
            }
          }
        },
        grid: {
          left: '3%',
          right: '4%',
          bottom: '3%',
          containLabel: true
        },
        xAxis: [
          {
            boundaryGap: false
          }
        ],
        yAxis: [
          {
            type: 'value'
          }
        ]
      }
 }}
 ,async mounted(){
   
   const {data:ret}= await this.$XHR.get('reports/type/1')
   if(ret?.meta?.status!==200) return fn.mg("error","获取失败")
   _.merge(ret.data,this.options)
   let myc= echarts.init(document.querySelector(".main")).setOption(ret.data)
 }

}
</script>

<style lang="less" scoped>

</style>